<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<script type="text/javascript" src="js/jquery.itextclear.js"></script>

<script type="text/javascript">
    $(document).ready(function() {
        $('input[type=text], input[type=password], input[type=url], input[type=email], input[type=number], textarea', '.form').iTextClear();
    });
</script>
<!-- jQplot CSS -->

<link rel="stylesheet" media="screen" href="CSS/Tree.css"/>
<!-- jQplot CSS END -->

<!-- DATATABLES CSS -->
<link rel="stylesheet" media="screen" href="lib/datatables/css/vpad.css"/>
<script type="text/javascript" src="lib/datatables/js/jquery.dataTables.js"></script>
<script type="text/javascript" src="${ctx}/js/ajaxupload_tx.3.6.js"></script>
<script type="text/javascript" src="${ctx}/js/global_util.js"></script>
<!--<script type="text/javascript">
$(document).ready(function() {
$('#example').dataTable({
"sPaginationType": "full_numbers"
});
});
</script>
-->
<!-- DATATABLES CSS END -->

<script>
    $(document).ready(function() {
        $('#simple-button').popover('#simple-popover', {});
        $('#top-button').popover('#top-popover', {preventLeft: true, preventRight: true, preventBottom:true});
    });
</script>

<h1 class="page-title">添加人才储备库信息</h1>

<div class="container_12 clearfix leading" style="height:100%;overflow:hidden;">
<div class="grid_12">
<!-- wizard -->
<form id="talentcreate_form" name="talent_form" class="wizard" novalidate>
<nav>
    <ul class="clearfix">
        <li class="active"><strong>1.</strong> 公用属性</li>
        <li><strong>2.</strong> 私用属性</li>
        <li><strong>3.</strong> 教育情况</li>
        <li><strong>4.</strong> 培训情况</li>
        <li><strong>5.</strong> 工作经历</li>
        <li><strong>6.</strong> 家庭情况</li>
        <li><strong>7.</strong> 完成</li>
    </ul>
</nav>

<div class="items">

<!-- page1 -->
<section>

    <header>
        <h2>
            <strong>步骤 1: </strong> 输入员工公司属性信息
            <em>Enter the employees' basic information:</em>
        </h2>
    </header>

    <section>
        <ul class="clearfix">
            <!-- email -->
            <li class="required double">
                <label>
                    <strong>1.</strong> 照片 <span>*</span><br/>
                    <img width="120" height="135" src="images/Avatar.jpg" id="image_upload">
                    <input type="hidden" name="employeeinfoBase.facePath" id="emp_facePath">
                </label>
                <label>
                    <strong>1.</strong> 姓名 <span>*</span><br/>
                    <input type="text" class="full" name="employeeinfoBase.name" required/>
                </label>
                <label>
                    <strong>1.</strong> 性别 <span>*</span><br/>
                    <select id="sex" name="employeeinfoBase.sex" class="full" required="required">
                        <option value="">-- 请选择 --</option>
                        <option value="0">先生</option>
                        <option value="1">女士</option>
                    </select>
                </label>

            </li>

            <!-- username --><!-- password -->
        </ul>
    </section>

    <footer class="clearfix">
        <button type="button" class="next fr">下一步 &raquo;</button>
    </footer>

</section>

<!-- page2 -->
<section>

<header>
    <h2>
        <strong>步骤 2: </strong> 输入员工个人属性信息 <b></b>
        <em>Enter the staff for more information:</em>
    </h2>
</header>

<section>
<ul class="clearfix">
<!-- address -->
<li class="required ftimes">
    <label>
        <strong>1.</strong> 出生年月 <span>*</span><br/>
        <input type="text" name="employeeinfoBase.birthday" class="full" onfocus="WdatePicker()"/>
    </label>
    <label>
        <strong>1.</strong> 户籍地址 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.census"/>
    </label>
    <label>
        <strong>1.</strong> 身份证 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.idcard"/>
    </label>
    <label>
        <strong>1.</strong> 名族 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.folk"/>
    </label>

</li>
<li class="required ftimes">
    <label>
        <strong>1.</strong> 身高 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.stature"/>
    </label>
    <label>
        <strong>1.</strong> 档案所在地 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.archives"/>
    </label>
    <label>
        <strong>1.</strong> 左眼视力 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.eyeLeft"/>
    </label>
    <label>
        <strong>1.</strong> 右眼视力 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.eyeRight"/>
    </label>

</li>
<li class="required ftimes">
    <label>
        <strong>1.</strong> 体重 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.avoirdupois"/>
    </label>
    <label>
        <strong>1.</strong> 联系地址 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.address"/>
    </label>
    <label>
        <strong>1.</strong> 电话 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.tel"/>
    </label>
    <label>
        <strong>1.</strong> 住所邮编 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.postcode"/>
    </label>

</li>
<li class="required ftimes">
    <label>
        <strong>1.</strong> 邮箱 <span>*</span><br/>
        <input type="email" class="full" name="employeeinfoBase.email"/>
    </label>
    <label>
        <strong>1.</strong> 手机 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.handSet"/>
    </label>
    <label>
        <strong>1.</strong> 婚否 <span>*</span><br/>
        <select name="employeeinfoBase.marry" class="full">
            <option value="">-- 请选择 --</option>
            <option value="0">未婚</option>
            <option value="1">已婚</option>
        </select>
    </label>
    <label>
        <strong>1.</strong> 入职期望薪资 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.compensation"/>
    </label>

</li>
<li class="required ftimes">
    <label>
        <strong>1.</strong> 英语阅读 <span>*</span><br/>
        <select name="employeeinfoBase.englishRead" class="full">
            <option value="">-- 请选择 --</option>
            <option value="1">一般</option>
            <option value="2">熟练</option>
            <option value="3">精通</option>
        </select>
    </label>
    <label>
        <strong>1.</strong> 其他语言阅读 <span>*</span><br/>
        <select name="employeeinfoBase.languageRead" class="full">
            <option value="">-- 请选择 --</option>
            <option value="1">一般</option>
            <option value="2">熟练</option>
            <option value="3">精通</option>
        </select>
    </label>
    <label>
        <strong>1.</strong> 英语证书 <span>*</span><br/>
        <select name="employeeinfoBase.englishLetter" class="full">
            <option value="">-- 请选择 --</option>
            <option value="3">三级</option>
            <option value="4">四级</option>
            <option value="6">六级</option>
            <option value="8">八级</option>
        </select>
    </label>
    <label>
        <strong>1.</strong> 学历 <span>*</span><br/>
        <select name="employeeinfoBase.certificate" style="opacity: 0;" class="full">
            <option value="">-- 请选择 --</option>
            <option value="1">小学</option>
            <option value="2">初中</option>
            <option value="3">高中</option>
            <option value="4">大专</option>
            <option value="5">本科</option>
            <option value="6">硕士</option>
            <option value="7">博士</option>
            <option value="8">博士后</option>
        </select>
    </label>

</li>
<li class="required ftimes">
    <label>
        <strong>1.</strong> 英语书写 <span>*</span><br/>
        <select name="employeeinfoBase.englishWrite" class="full">
            <option value="">-- 请选择 --</option>
            <option value="1">一般</option>
            <option value="2">熟练</option>
            <option value="3">精通</option>
        </select>
    </label>
    <label>
        <strong>1.</strong> 其他语言书写 <span>*</span><br/>
        <select name="employeeinfoBase.languageWrite" class="full">
            <option value="">-- 请选择 --</option>
            <option value="1">一般</option>
            <option value="2">熟练</option>
            <option value="3">精通</option>
        </select>
    </label>
    <label>
        <strong>1.</strong> 子女 <span>*</span><br/>
        <select name="employeeinfoBase.baby" class="full">
            <option value="">-- 请选择 --</option>
            <option value="0">无小孩</option>
            <option value="1">有小孩</option>
        </select>
    </label>
    <label>
        <strong>1.</strong> 其他说明事项 <span>*</span><br/>
        <input type="text" class="full" name="email"/>
    </label>

</li>
<li class="required ftimes">
    <label>
        <strong>1.</strong> 英语会话 <span>*</span><br/>
        <select name="employeeinfoBase.englishDialog" class="full">
            <option value="">-- 请选择 --</option>
            <option value="1">一般</option>
            <option value="2">熟练</option>
            <option value="3">精通</option>
        </select>
    </label>
    <label>
        <strong>1.</strong> 其他语言会话 <span>*</span><br/>
        <select name="employeeinfoBase.languageDialog" class="full">
            <option value="">-- 请选择 --</option>
            <option value="1">一般</option>
            <option value="2">熟练</option>
            <option value="3">精通</option>
        </select>
    </label>
    <label>
        <strong>1.</strong> 员工状态 <span>*</span><br/>
        <select name="employeeinfoBase.state" class="full">
            <option value="">-- 请选择 --</option>
            <option value="1">在职</option>
            <option value="2">离职</option>
            <option value="3" selected>人才库</option>
        </select>
    </label>
    <label>
        <strong>1.</strong> 工作年限 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.workAge"/>
    </label>

</li>
<li class="required ftimes">
    <label>
        <strong>1.</strong> 建议岗位 <span>*</span><br/>
        <input type="text" class="full" name="employeeinfoBase.suggestDuty"/>
    </label>
</li>

<!-- zip / city -->
</ul>
</section>

<footer class="clearfix">
    <button type="button" class="prev fl">&laquo; 上一步</button>
    <button type="button" class="next fr">下一步 &raquo;</button>
</footer>

</section>


<!-- page3 -->
<section>

    <header>
        <h2>
            <strong>步骤 3: </strong> 输入教育经历
            <em>教育经历</em>
        </h2>
    </header>

    <section>

        <div id="list_eduList">

        </div>
        <div class="portlet">
            <header>

            </header>
            <section class="clearfix">
                <div class="grid_12">
                    <dl>
                        <dt>学校名称</dt>
                        <dd>
                            <input type="text" id="eduSchoolname" name="employeeinfoEducation.schoolName" class="full"/>
                        </dd>
                        <dt>所学专业</dt>
                        <dd>
                            <input type="text" id="eduSpecialty" name="employeeinfoEducation.specialty" class="full"/>
                        </dd>
                        <dt>学位</dt>
                        <dd>
                            <input type="text" id="eduDegree" name="employeeinfoEducation.degree" class="full"/>
                        </dd>
                        <dt>时间</dt>
                        <dd>
                            开始<input type="text" id="eduBeginDate" name="employeeinfoEducation.beginDate"
                                     onfocus="WdatePicker({maxDate:$('#eduendDate').val()})" style="width:30%">
                            结束<input type="text" id="eduendDate" name="employeeinfoEducation.endDate"
                                     onfocus="WdatePicker({minDate:$('#eduBeginDate').val()})" style="width:30%">
                            <input type="hidden" id="edu_primary_id" name="employeeinfoEducation.id" value="">
                        </dd>


                    </dl>
                    <div class="form-action clearfix">
                        <p style="padding-top:10px">
                            <a class="button" href="javascript:submitEducation()"><span
                                    style="background:url(${ctx}/images/img/add.png)"
                                    class="icon">&nbsp;</span>新增项目</a>
                        </p>
                    </div>
                </div>


            </section>
        </div>
    </section>

    <footer class="clearfix">
        <button type="button" class="prev">&laquo; 上一步</button>
        <button type="button" class="next fr">下一步 &raquo;</button>
    </footer>

</section>

<!-- page4 -->
<section>

    <header>
        <h2>
            <strong>步骤 4: </strong> 输入培训情况
            <em>培训情况</em>
        </h2>
    </header>

    <section>

        <div id="list_trainList">


        </div>
        <div class="portlet">
            <header>

            </header>
            <section class="clearfix">
                <div class="grid_12">
                    <dl>
                        <dt>证书</dt>
                        <dd>
                            <input type="text" id="train_letter" name="employeeinfoTrain.letter" class="full"/>
                        </dd>
                        <dt>培训地点</dt>
                        <dd>
                            <input type="text" id="train_address" name="employeeinfoTrain.trainAddress" class="full"/>
                        </dd>

                        <dt>培训时间</dt>
                        <dd>
                            开始
                            <input type="text" id="train_beginDate" name="employeeinfoTrain.beginDate"
                                   onfocus="WdatePicker({maxDate:$('#train_endDate').val()})" style="width:30%">
                            结束
                            <input type="text" id="train_endDate" name="employeeinfoTrain.endDate"
                                   onfocus="WdatePicker({minDate:$('#train_beginDate').val()})" style="width:30%">

                            <input type="hidden" id="train_primary_id" name="employeeinfoTrain.id" value="">
                        </dd>
                        <dt>培训内容</dt>
                        <dd>
                            <textarea class="full" id="train_content" name="employeeinfoTrain.trainContent"
                                      required="required" rows="5" placeholder="请输入培训内容"></textarea>
                        </dd>

                    </dl>
                    <div class="form-action clearfix">
                        <p style="padding-top:10px">
                            <a class="button" href="javascript:submitTrain()"><span
                                    style="background:url(${ctx}/images/img/add.png)"
                                    class="icon">&nbsp;</span>新增项目</a>
                        </p>
                    </div>
                </div>


            </section>
        </div>
    </section>

    <footer class="clearfix">
        <button type="button" class="prev">&laquo; 上一步</button>
        <button type="button" class="next fr">下一步 &raquo;</button>
    </footer>

</section>


<!-- page5 -->
<section>

    <header>
        <h2>
            <strong>步骤 5: </strong> 输入工作经历
            <em>工作经历</em>
        </h2>
    </header>

    <section>

        <div id="employee_exp">

        </div>
        <div class="portlet">
            <header>

            </header>
            <section class="clearfix">
                <div class="grid_12">
                    <dl>
                        <dt>公司名称</dt>
                        <dd>
                            <input type="text" id="exp_company" name="employeeWorkExperience.compname" class="full"/>
                        </dd>
                        <dt>职位</dt>
                        <dd>
                            <input type="text" id="exp_position" name="employeeWorkExperience.job" class="full"/>
                        </dd>

                        <dt>工作时间</dt>
                        <dd>
                            开始
                            <input type="text" id="exp_beginDate" name="employeeWorkExperience.beginDate"
                                   onfocus="WdatePicker({maxDate:$('#exp_endDate').val()})" style="width:30%">
                            结束
                            <input type="text" id="exp_endDate" name="employeeWorkExperience.endDate"
                                   onfocus="WdatePicker({minDate:$('#exp_beginDate').val()})" style="width:30%">
                            <input type="hidden" id="exp_primary_id" name="employeeWorkExperience.id" value="">
                        </dd>
                        <dt>月薪</dt>
                        <dd>
                            <input type="text" id="exp_pay" name="employeeWorkExperience.monthlyPay" class="full"/>
                        </dd>
                        <dt>证明人</dt>
                        <dd>
                            <input type="text" id="exp_prover" name="employeeWorkExperience.proveMan" class="full"/>
                        </dd>
                        <dt>联系电话</dt>
                        <dd>
                            <input type="text" id="exp_contel" name="employeeWorkExperience.contel" class="full"/>
                        </dd>
                        <dt>离职原因</dt>
                        <dd>
                            <textarea class="full" id="exp_reason" name="employeeWorkExperience.resignReason"
                                      required="required" rows="5" placeholder="请输入离职原因"></textarea>
                        </dd>
                    </dl>
                    <div class="form-action clearfix">
                        <p style="padding-top:10px">
                            <a class="button" href="javascript:submitExperience()"><span
                                    style="background:url(${ctx}/images/img/add.png)"
                                    class="icon">&nbsp;</span>新增项目</a>
                        </p>
                    </div>
                </div>


            </section>
        </div>
    </section>

    <footer class="clearfix">
        <button type="button" class="prev">&laquo; 上一步</button>
        <button type="button" class="next fr">下一步 &raquo;</button>
    </footer>

</section>


<!-- page6 -->
<section>

    <header>
        <h2>
            <strong>步骤 6: </strong> 输入家庭情况
            <em>家庭情况</em>
        </h2>
    </header>

    <section>

         <div id="employee_family">

        </div>
        <div class="portlet">
            <header>

            </header>
            <section class="clearfix">
                <div class="grid_12">
                    <dl>
                        <dt>家庭关系</dt>
                        <dd>
                            <input type="text" id="familyRelation" name="employeeinfoFamily.familyRelation"
                                   class="full"/>
                        </dd>
                        <dt>工作单位</dt>
                        <dd>
                            <input type="text" id="workCompany" name="employeeinfoFamily.compname" class="full"/>
                        </dd>
                        <dt>姓名</dt>
                        <dd>
                            <input type="text" id="fname" name="employeeinfoFamily.name" class="full"/>
                        </dd>
                        <dt>住宅地址</dt>
                        <dd>
                            <input type="text" id="faddress" name="employeeinfoFamily.address" class="full"/>
                        </dd>
                        <dt>紧急联系人</dt>
                        <dd>
                            <input type="text" id="furgentContactor" name="employeeinfoFamily.exigenceConname"
                                   class="full"/>
                        </dd>
                        <dt>紧系联系人关系</dt>
                        <dd>
                            <input type="text" id="furgentRelation" name="employeeinfoFamily.exigenceRelation"
                                   class="full"/>
                        </dd>
                        <dt>紧急联系人电话</dt>
                        <dd>
                            <input type="text" id="furgentTel" name="employeeinfoFamily.contel" class="full"/>
                            <input type="hidden" id="family_primary_id" name="employeeinfoFamily.id" value="">
                        </dd>

                    </dl>
                    <div class="form-action clearfix">
                        <p style="padding-top:10px">
                            <a class="button" href="javascript:saveFamily()"><span
                                    style="background:url(${ctx}/images/img/add.png)"
                                    class="icon">&nbsp;</span>新增项目</a>
                        </p>
                    </div>
                </div>


            </section>
        </div>
    </section>

    <footer class="clearfix">
        <button type="button" class="prev">&laquo; 上一步</button>
        <button type="button" class="next fr" onclick="submitForm()">下一步 &raquo;</button>
    </footer>

</section>
<!-- page7 -->
<section>

    <header>
        <h2>
            <strong>步骤 7: </strong> 完成!
            <em>储备人才：<span id="talent_Modify_userName"></span> 的信息已经成功录入系统.</em>
        </h2>
    </header>

    <section>
        <h3>本次录入用时<span id="talent_Modify_totalTime"></span>!</h3>
    </section>

    <footer class="clearfix">
        <!--<button type="button" class="prev">&laquo; 上一步</button>  -->
        <button type="button" class="prev"
                onclick="javascript:window.location.href='#employee/talent_main.xhtml'">&laquo; 录入人才资料
        </button>
    </footer>

</section>

</div>
<!--items-->

</form>
<!--wizard-->

</div>
</div>

<!-- WIZARD SETUP -->
<script type="text/javascript" src="js/jquery.wizard.js"></script>
<script>
$(function() {
    $('.wizard').wizard();

    AjaxUpload.init('${ctx}/file/upload.xhtml', "image_upload", "", "");
});

function onUploadSubmit(file, ext) {
    //    if(ext!="png" || ext!="jpg"){
    //        alert("上传文件格式不正确");
    //        return;
    //    }
    //    alert("file=" + file + ", ext=" + ext)
}
function onUploadComplete(file, response) {
    //{"message":"filePath","result":"F:\\Projects\\ehr\\src\\main\\webapp\\WEB-INF\\pages\\temp\\2012-06-26\\1340725945119_Qaga_1101134.jpg","success":true}
    //alert("file=" + file + ":" + response)
    var d;
    try {
        d = eval("[" + response + "]");
    }
    catch(err) {
        alert("文件上传错误！");
        return;
    }

    //var message = d[0].message;
    //上传出错
    if (d[0].success == false) {
        alert("上传出错")
        return;
    }
    //上传成功
    else {
        var realPath = d[0].result;
        //alert(realPath);
        $("#image_upload").attr("src", realPath);
        $("#emp_facePath").val(realPath);
        //alert("上传成功")
    }
}
function submitForm() {

    var url = "${ctx}/employee/talent_create.xhtml";
    $.ajax(url, {
        type:"POST",
        data:$("#talentcreate_form").serialize(),
        dataType:"json",
        cache:false,
        success:function(pojo) {
            $("#talent_Modify_userName").html(pojo.userName);
            $("#talent_Modify_totalTime").html(pojo.usedTime);
        },
        complete:function(a) {

        }
    });
}


function toUrl(url) {
    window.location.href = url;
}
function submitEducation() {
    if (checkNull($("#eduSchoolname").attr("value"))) {
        alert("学校名称不能为空");
        return;
    }

    if (checkNull($("#eduSpecialty").attr("value"))) {
        alert("所学专业不能为空");
        return;
    }

    if (checkNull($("#eduDegree").attr("value"))) {
        alert("学位不能为空");
        return;
    }

    if (checkNull($("#eduBeginDate").attr("value"))) {
        alert("开始时间不能为空");
        return;
    }

    if (checkNull($("#eduendDate").attr("value"))) {
        alert("结束时间不能为空");
        return;
    }
    var url = "${ctx}/employee/talentedu_list.xhtml";
    $.ajax(url, {
        type:"POST",
        data:$("#talentcreate_form").serialize(),
        dataType:"html",
        cache:false,
        success:function(a) {
           $("#list_eduList").html("");
            $("#list_eduList").html(a);

            $("#eduSchoolname").val("");
            $("#eduSpecialty").val("");
            $("#eduDegree").val("");
            $("#eduBeginDate").val("");
            $("#eduendDate").val("");
            $("#edu_primary_id").val("");
            //修正上一步下一步div hideen bug.
            $("#talentcreate_form").css("height", $("#talentcreate_form").height() + 120);
        },
        complete:function() {
           
        }
    });
}
function submitTrain() {
    if (checkNull($("#train_letter").attr("value"))) {
        alert("请输入培训证书");
        return;
    }
    if (checkNull($("#train_address").attr("value"))) {
        alert("请输入培训地点");
        return;
    }
    if (checkNull($("#train_beginDate").attr("value"))) {
        alert("请输入培训开始时间");
        return;
    }
    if (checkNull($("#train_endDate").attr("value"))) {
        alert("请输入培训结束时间");
        return;
    }
    if (checkNull($("#train_content").attr("value"))) {
        alert("请输入培训内容");
        return;
    }
    var url = "${ctx}/employee/talenttrain_list.xhtml";
    $.ajax(url, {
        type:"POST",
        data:$("#talentcreate_form").serialize(),
        dataType:"html",
        cache:false,
        success:function(a) {
           $("#list_trainList").html("");
            $("#list_trainList").html(a);
            //清空培训表单数据
            $("#train_letter").val("");
            $("#train_address").val("");
            $("#train_content").val("");
            $("#train_beginDate").val("");
            $("#train_endDate").val("");
            $("#train_primary_id").val("");
            $("#talentcreate_form").css("height", $("#talentcreate_form").height() + 110);
        },
        complete:function() {
           
        }
    });
}

function submitExperience() {
    if (checkNull($("#exp_company").attr("value"))) {
        alert("请输入公司名称");
        return;
    }
    if (checkNull($("#exp_position").attr("value"))) {
        alert("请输入职位");
        return;
    }
    if (checkNull($("#exp_beginDate").attr("value"))) {
        alert("请输入工作开始时间");
        return;
    }
    if (checkNull($("#exp_endDate").attr("value"))) {
        alert("请输入工作结束时间");
        return;
    }
    if (checkNull($("#exp_pay").attr("value"))) {
        alert("请输入月薪");
        return;
    }
    if (checkNull($("#exp_prover").attr("value"))) {
        alert("请输入证明人");
        return;
    }
    if (checkNull($("#exp_contel").attr("value"))) {
        alert("请输入证明人");
        return;
    }
    if (checkNull($("#exp_reason").attr("value"))) {
        alert("请输入离职原因");
        return;
    }
    var url = "${ctx}/employee/talentexp_list.xhtml";
    $.ajax(url, {
        type:"POST",
        data:$("#talentcreate_form").serialize(),
        dataType:"html",
        cache:false,
        success:function(a) {
            $("#employee_exp").html("");
            $("#employee_exp").append(a);
            //解决上一步，下一步隐藏的bug
            $("#talentcreate_form").css("height", $("#talentcreate_form").height() + 220);
            //清空表单数据
            $("#exp_position").val("");
            $("#exp_company").val("");
            $("#exp_beginDate").val("");
            $("#exp_endDate").val("");
            $("#exp_pay").val("");
            $("#exp_prover").val("");
            $("#exp_contel").val("");
            $("#exp_reason").val("");
            $("#exp_primary_id").val("");
        },
        complete:function() {

        }
    });
}
function saveFamily() {
    if (checkNull($("#familyRelation").attr("value"))) {
        alert("请输入家庭关系");
        return;
    }
    if (checkNull($("#workCompany").attr("value"))) {
        alert("请输入工作单位");
        return;
    }
    if (checkNull($("#fname").attr("value"))) {
        alert("请输入姓名");
        return;
    }
    if (checkNull($("#faddress").attr("value"))) {
        alert("请输入住宅地址");
        return;
    }
    if (checkNull($("#furgentContactor").attr("value"))) {
        alert("请输入紧急联系人");
        return;
    }
    if (checkNull($("#furgentRelation").attr("value"))) {
        alert("请输入紧急联系人关系");
        return;
    }
    if (checkNull($("#furgentTel").attr("value"))) {
        alert("请输入紧急联系人电话");
        return;
    }
    var url = "${ctx}/employee/talentfamily_list.xhtml?t=<%=new java.util.Date().getTime()%>";
    $.ajax(url, {
        type:"POST",
        data:$("#talentcreate_form").serialize(),
        dataType:"html",
        cache:false,
        success:function(a) {
            $("#employee_family").html("");
            $("#employee_family").append(a);
            $("#familyRelation").val("");
            $("#workCompany").val("");
            $("#fname").val("");
            $("#faddress").val("");
            $("#furgentContactor").val("");
            $("#furgentRelation").val("");
            $("#furgentTel").val("");
            $("#family_primary_id").val("");

            $("#talentcreate_form").css("height", $("#talentcreate_form").height() + 220);
        },
        complete:function() {
            
        }
    });
}
//删除教育情况
function eduDelete(obj) {
    if (confirm("你确定要删除吗？")) {
        var url = "${ctx}/employee/talentedu_delete.xhtml";
        $.ajax(url, {
            type:"POST",
            data:{"id":obj,"state":1},
            dataType:"html",
            cache:false,
            success:function(a) {
                var con = $("#edu_" + obj);
                con.hide();
                $("#talentcreate_form").css("height", $("#talentcreate_form").height() - 50);
                $("#eduSchoolname").val("");
                $("#eduSpecialty").val("");
                $("#eduDegree").val("");
                $("#eduBeginDate").val("");
                $("#eduendDate").val("");
            },
            complete:function() {

            }
        });
    }

}
//修改教育情况
function eduModify(obj) {
    var url = "${ctx}/employee/getTalentEduinfoById.xhtml?t=<%=new java.util.Date().getTime()%>&eduId=" + obj;
    $.ajax(url, {
        type:"POST",
        dataType:"json",
        cache:false,
        success:function(edu) {
            if (edu != null) {
                $("#eduSchoolname").val(edu.schoolName);
                $("#eduSpecialty").val(edu.specialty);
                $("#eduDegree").val(edu.degree);
                $("#eduBeginDate").val(edu.beginDateStr);
                $("#eduendDate").val(edu.endDateStr);
                $("#edu_primary_id").val(edu.id);  //edu_primary_id
                $("#edu_btn_" + obj).hide();
                $("#edu_" + obj).hide();
                $("#talentcreate_form").css("height", $("#talentcreate_form").height() - 50);
            }
        },
        complete:function() {
        }
    });
}

//删除培训经历
function trainDelete(obj) {
    if (confirm("你确定要删除吗？")) {
        var url = "${ctx}/employee/talentedu_delete.xhtml";
        $.ajax(url, {
            type:"POST",
            data:{"id":obj,"state":2},
            dataType:"html",
            cache:false,
            success:function(a) {
                var con = $("#train_" + obj);
                con.hide();
                $("#talentcreate_form").css("height", $("#talentcreate_form").height() - 50);
                $("#train_letter").val("");
                $("#train_address").val("");
                $("#train_content").val("");
                $("#train_beginDate").val("");
                $("#train_endDate").val("");
            },
            complete:function() {
            }
        });
    }

}
function trainModify(obj) {
    var url = "${ctx}/employee/getTalentTraininfoById.xhtml?eduId=" + obj;
    $.ajax(url, {
        type:"POST",
        dataType:"json",
        cache:false,
        success:function(train) {
            if (train != null) {
                $("#train_letter").val(train.letter);
                $("#train_address").val(train.trainAddress);
                $("#train_content").val(train.trainContent);
                $("#train_beginDate").val(train.beginDateStr);
                $("#train_endDate").val(train.endDateStr);
                $("#train_primary_id").val(train.id);  //train_primary_id
                $("#train_btn_" + obj).hide();
                $("#train_" + obj).hide();
                $("#talentcreate_form").css("height", $("#talentcreate_form").height() - 50);
            }
        },
        complete:function() {
        }
    });

}

//删除工作经历
function expDelete(obj) {
    if (confirm("你确定要删除吗？")) {
        var url = "${ctx}/employee/talentedu_delete.xhtml"
        $.ajax(url, {
            type:"POST",
            data:{"id":obj,"state":3},
            dataType:"html",
            cache:false,
            success:function(a) {
                var con = $("#exp_" + obj);
                con.hide();
                $("#talentcreate_form").css("height", $("#talentcreate_form").height() - 110);
                $("#exp_position").val("");
                $("#exp_company").val("");
                $("#exp_beginDate").val("");
                $("#exp_endDate").val("");
                $("#exp_pay").val("");
                $("#exp_prover").val("");
                $("#exp_contel").val("");
                $("#exp_reason").val("");
            },
            complete:function() {
            }
        });
    }

}
function expModify(obj) {
     var url = "${ctx}/employee/getTalentExperienceById.xhtml?eduId=" + obj;
    $.ajax(url, {
        type:"POST",
        dataType:"json",
        cache:false,
        success:function(exp) {
            if (exp != null) {
                $("#exp_position").val(exp.job);
                $("#exp_company").val(exp.compname);
                $("#exp_beginDate").val(exp.beginDateStr);
                $("#exp_endDate").val(exp.endDateStr);
                $("#exp_pay").val(exp.monthlyPay);
                $("#exp_prover").val(exp.proveMan);
                $("#exp_contel").val(exp.contel);
                $("#exp_reason").val(exp.resignReason);

                $("#exp_primary_id").val(exp.id);  //train_primary_id
                $("#exp_btn_" + obj).hide();
                $("#exp_" + obj).hide();
                $("#talentcreate_form").css("height", $("#talentcreate_form").height() - 110);
            }
        },
        complete:function() {
        }
    });
}

//删除家庭情况
function famDelete(obj) {
    if (confirm("你确定要删除吗？")) {
        var url = "${ctx}/employee/talentedu_delete.xhtml"
        $.ajax(url, {
            type:"POST",
            data:{"id":obj,"state":4},
            dataType:"html",
            cache:false,
            success:function(a) {
                var con = $("#fam_" + obj);
                con.hide();
                $("#talentcreate_form").css("height", $("#talentcreate_form").height() - 110);
                $("#familyRelation").val("");
                $("#workCompany").val("");
                $("#fname").val("");
                $("#faddress").val("");
                $("#furgentContactor").val("");
                $("#furgentRelation").val("");
                $("#furgentTel").val("");

            },
            complete:function() {
            }
        });
    }

}
function famModify(obj) {
    var url = "${ctx}/employee/getTalentFamilyById.xhtml?eduId=" + obj;
    $.ajax(url, {
        type:"POST",
        dataType:"json",
        cache:false,
        success:function(fam) {
            if (fam != null) {
                $("#familyRelation").val(fam.familyRelation);
                $("#workCompany").val(fam.compname);
                $("#fname").val(fam.name);
                $("#faddress").val(fam.address);
                $("#furgentContactor").val(fam.exigenceConname);
                $("#furgentRelation").val(fam.exigenceRelation);
                $("#furgentTel").val(fam.contel);

                $("#family_primary_id").val(fam.id);  //fam_primary_id
                $("#fam_btn_" + obj).hide();
                $("#fam_" + obj).hide();
                $("#talentcreate_form").css("height", $("#talentcreate_form").height() - 100);
            }
        },
        complete:function() {
        }
    });
}
</script>
<!-- WIZARD SETUP END -->

</body>
</html>